// 2013-7-28下午11:51:44  net.betou.trade.entity.main.base.BaseCategory.java

package net.betou.trade.entity.main.base;

import java.io.Serializable;
import java.util.Date;

import net.betou.trade.entity.main.AgentAndAdmins;
import net.betou.trade.entity.main.Category;

/**
 * 品种
 * 为了保证数据的完整性，系统管理员是不可以进行品种的添加的
 * @author 叶装装
 */
public abstract class BaseCategory implements Serializable{
	
	private static final long serialVersionUID = 1L;

	private Integer id;
	private String name;
	private String pinyin;
	private Date addDate;
	private String description; // 描述
	
	public BaseCategory( ){
	}
	
	// many to one
	private AgentAndAdmins admin;

	public Integer getId( ) {
		return id;
	}

	public void setId( Integer id ) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}

	public String getName( ) {
		return name;
	}

	public void setName( String name ) {
		this.name = name;
	}

	public String getPinyin( ) {
		return pinyin;
	}

	public void setPinyin( String pinyin ) {
		this.pinyin = pinyin;
	}

	public Date getAddDate( ) {
		return addDate;
	}

	public void setAddDate( Date addDate ) {
		this.addDate = addDate;
	}

	public AgentAndAdmins getAdmin( ) {
		return admin;
	}

	public void setAdmin( AgentAndAdmins admin ) {
		this.admin = admin;
	}

	public String getDescription( ) {
		return description;
	}

	public void setDescription( String description ) {
		this.description = description;
	} 
	
	private int hashCode = Integer.MIN_VALUE;
	
	public boolean equals( Object obj ) {
		if( null == obj )
			return false;
		if( !( obj instanceof Category ) )
			return false;
		else{
			Category category = ( Category ) obj;
			if( null == this.getId( ) || null == category.getId( ) )
				return false;
			else
				return( this.getId( ).equals( category.getId( ) ) );
		}
	}

	public int hashCode( ) {
		if( Integer.MIN_VALUE == this.hashCode ){
			if( null == this.getId( ) )
				return super.hashCode( );
			else{
				String hashStr = this.getClass( ).getName( ) + ":" + this.getId( ).hashCode( );
				this.hashCode = hashStr.hashCode( );
			}
		}
		return this.hashCode;
	}
	
	
	
}
